home *** CD-ROM | disk | FTP | other *** search
- From: mk@anuurn.do.open.de (Martin Koehling)
- Subject: Two Patches for MiNT 1.09
- Date: Mon, 23 Aug 1993 20:24:32 MEZ
- Mime-Version: 1.0
-
- Hi!
-
- There is a small bug in proc.c: when the system runs out of kernel
- memory while allocating memory for a fork()ed processes' region map,
- duplicated FILEPTRs and cookies are not released; moving the memory
- allocation code up a few lines should cure the problem:
-
- *** o:\proc.c Wed Aug 18 20:16:34 1993
- --- proc.c Wed Aug 18 22:00:04 1993
- ***************
- *** 122,127 ****
- --- 122,140 ----
-
- p->usrtime = p->systime = p->chldstime = p->chldutime = 0;
-
- + /* allocate space for memory regions, to be filled later */
- + p->mem = (MEMREGION **) kmalloc(p->num_reg * SIZEOF(MEMREGION *));
- + if (!p->mem) {
- + dispose_proc(p);
- + goto nomem;
- + }
- + p->addr = (virtaddr *)kmalloc(p->num_reg * SIZEOF(virtaddr));
- + if (!p->addr) {
- + kfree(p->mem);
- + dispose_proc(p);
- + goto nomem;
- + }
- +
- /* copy open handles */
- for (i = MIN_HANDLE; i < MAX_OPEN; i++) {
- if ((f = p->handle[i]) != 0) {
- ***************
- *** 149,166 ****
- p->searches = 0;
-
- /* copy memory */
- - p->mem = (MEMREGION **) kmalloc(p->num_reg * SIZEOF(MEMREGION *));
- - if (!p->mem) {
- - dispose_proc(p);
- - goto nomem;
- - }
- - p->addr = (virtaddr *)kmalloc(p->num_reg * SIZEOF(virtaddr));
- - if (!p->addr) {
- - kfree(p->mem);
- - dispose_proc(p);
- - goto nomem;
- - }
- -
- for (i = 0; i < curproc->num_reg; i++) {
- p->mem[i] = curproc->mem[i];
- if (p->mem[i] != 0)
- --- 162,167 ----
-
- Another (small) problem in dosound() (xbios.c): when it is compiled
- with Pure C, the #&$$@6"6$& optimizer silently removes the statement
- "(void)(*((volatile char *)ptr));".
-
- A simple patch should fix this:
-
- *** o:\xbios.c Wed Aug 18 20:16:50 1993
- --- xbios.c Mon Aug 23 19:43:06 1993
- ***************
- *** 269,275 ****
- if (!no_mem_prot && ((long)ptr >= 0)) {
- /* check that this process has access to the memory */
- /* (if not, the next line will cause a bus error) */
- ! (void)(*((volatile char *)ptr));
-
- /* OK, now make sure that interrupt routines will have access,
- * too
- --- 269,276 ----
- if (!no_mem_prot && ((long)ptr >= 0)) {
- /* check that this process has access to the memory */
- /* (if not, the next line will cause a bus error) */
- ! char dummy = (*((volatile char *)ptr));
- ! UNUSED(dummy) ;
-
- /* OK, now make sure that interrupt routines will have access,
- * too
-
- --
- Martin Koehling | mk@anuurn.do.open.de | Martin_Koehling@un.maus.ruhr.de
-